package club.monkeywood.dataobject;


import club.monkeywood.enums.order.OrderStatusEnum;
import club.monkeywood.enums.order.PayStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;

//表名不能为：Order，关键字Order在mysql中不能作为表名，否则sql会报错
@Entity
@DynamicUpdate  //自动更新时间
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderMaster {

  @Id    //用随机字符串生成器生成key
  private String id;

  private Integer buyerId;
  private BigDecimal orderAmount;

  //默认值：0/新下单
  private Integer orderStatus = OrderStatusEnum.NEW.getCode();

  //默认值：0/等待支付
  private Integer payStatus = PayStatusEnum.WAIT.getCode();

  private Date createTime;
  private Date updateTime;

}
